<!-- 此分类详细信息，包括文章时间线 -->
<script setup>
import Heatmap from '@/components/heatmap/Heatmap.vue'
import moment from 'moment'

defineProps({ cateInfo: Object })

</script>

<template>
  <div class="view-wrapper">
    <div class="section-wrapper" :style="{ backgroundImage: `url(${cateInfo.img})` }">
      <div class="section-header">
        <h1 class="section-title"> {{ cateInfo.title }} </h1>
      </div>
      <div class="byline">
        <div class="category-info">
          <div class="category-date">
            {{ moment(cateInfo?.createTime).format("YYYY-MM-DD") }}
          </div>
          <div class="category-count">Total {{ cateInfo.count }}</div>
        </div>
      </div>
      <div class="category-content">
        <div class="section-desc"> {{ cateInfo.desc }} </div>
        <div v-if="cateInfo.children">
          <p>See Also</p>
          <div class="category-list">
            <div v-for="item in cateInfo.children" :key="item.id">
              <RouterLink :to="`/article/${item.title}/index`" class="category-item">
                {{ item.title }}
              </RouterLink>
            </div>
          </div>
        </div>
      </div>
      <!-- <Heatmap></Heatmap> -->
    </div>
  </div>
</template>

<style scoped lang="scss">
.section-wrapper {
  padding: 10px 10px 30px;
  background-color: var(--view-category-bgc);
  min-height: 400px;
  box-shadow: 0px 2px 6px rgba(54, 54, 54, 0.5);
  border: 1px solid var(--border-secondary);
  margin-bottom: 2rem;
  min-height: 500px;
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: 60% auto;
}

.section-header {
  min-height: 5rem;
  margin: 10px 0 20px;
  padding: 10px 0;
  padding-bottom: 10px;
  background: rgba(165, 219, 159, 0.656);
  box-shadow: 0px 4px 7px rgba(63, 89, 95, 0.73);
}

.section-title {
  font-family: "Oswald", "Bookman Old Style", serif;
  font-size: 2.50rem;
  border-bottom: 1px solid black;
  letter-spacing: 0.12rem;
  width: max-content;
  margin: auto;
  color: rgb(1, 71, 3);
}

.byline {
  margin-left: 1rem;
  padding-left: .5rem;
  color: rgb(116, 120, 106);
  border-left: 2px solid red;
}

.category-content {
  margin: 2rem 1rem;
  text-align: center;
}

.section-desc {
  font-size: 1rem;
  margin: 2rem 0;
  padding: 2rem;
  background-color: var(--bgc-02);
  border: 1px solid var(--border-primary);
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 2em 0;
}

.category-item {
  display: block;
  margin: 10px;
  padding: 1rem;
  border: 1px solid var(--border-secondary);
  border-radius: 2px;
  font-size: 1.2rem;
  color: var(--text-main);
  background-color: var(--bgc-02);

  &:hover {
    background-color: var(--bgc-01);
  }
}

.heatmap-wrapper {
  margin: 10px 20px;
}
</style>
